package com.kizitonwose.calendarview.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiuQingHua
 * @version 1.0
 * @date 2021/2/22/022 11:10
 */
public class ListExtension<E> {
    private List<E> list;

    public ListExtension(List<E> list) {
        this.list = list;
    }

    public static <E> ListExtension<E> getInstance(List<E> collection) {
        return new ListExtension<>(collection);
    }


    public List<E> getList() {
        return list;
    }


    public ListExtension<E> orEmpty() {
        list = (list != null ? list : new ArrayList<E>());
        return this;
    }


    public ListExtension<E> plus(E e) {
        list.add(e);
        return this;
    }


}
